package com.rcd.manager.dao.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.rcd.dao.IItemDao;
import com.rcd.exception.MyException;
import com.rcd.manager.dao.IItemManagerDao;
import com.rcd.util.Page;
import com.rcd.vo.Item;
//@Component("iItemManagerDao") @Transactional
public class IItemManagerDaoimpl implements IItemManagerDao {

	private IItemDao dao;
	
	//@Resource(name="iItemDao")
	public void setDao(IItemDao dao) {
		this.dao = dao;
	}
	public void addItem(Item item){
		// TODO Auto-generated method stub
		try{
			this.dao.addItem(item);
		}catch(MyException e)
		{
			e.printStackTrace();
		}
	}

	public void deleteAll(int[] iid) {
		// TODO Auto-generated method stub
		try{
			this.dao.deleteAll(iid);
		}catch(MyException e)
		{
			e.printStackTrace();
		}
	}

	public void deleteItem(int iid)  {
		// TODO Auto-generated method stub
		try{
			this.dao.deleteItem(iid);
		}catch(MyException e)
		{
			e.printStackTrace();
		}
	}

	public List<Item> findAll(Page page) {
		// TODO Auto-generated method stub
			List<Item> list = null;
		try{
			list =  this.dao.findAll(page);
		}catch(MyException e)
		{
			e.printStackTrace();
		}
		return list;
	}

	public Item findById(int iid) {
		// TODO Auto-generated method stub
		Item item = null;
		try{
			
			item =  this.dao.findById(iid);
		}catch(MyException e)
		{
			e.printStackTrace();
		}
		return item;
	}

	public int getCount(Page page) {
		// TODO Auto-generated method stub
		int count = 0 ;
		try{
	     count =  this.dao.getCount(page);
		}catch(MyException e){
			e.printStackTrace();
		}
		return count;
	}

	public void updateItem(Item item)  {
		// TODO Auto-generated method stub
		try{
			this.dao.updateItem(item);
		}catch(MyException e)
		{
			e.printStackTrace();
		}
	
	}


}
